<?php

// +----------------------------------------------------------------------

namespace app\api\controller;

use app\common\controller\Api;
use util\Elind;
use speaker\Speaker;
use util\Wxsdk;
use think\Db;
/**
 * TokenAPI控制器
 * @package app\api\controller
 */
class Token extends Api
{

	/**
	 * @name 获取易联云token
	 * @method POST
	 * @return json ( expire_time & access_token )
	 */
	public function elind()
	{
		$elind = new Elind();
		$token =  $elind->getToken();
		if ($token == false) {
			$this->error($elind->getError());
		}
		$this->success('获取成功', $token);
	}
	/**
	 * @name 获取立通智联签名
	 * @method POST
	 * @return json ( expire_time & access_token )
	 */
	public function speaker()
	{
		$speaker = new Speaker();
		$token =  $speaker->getToken();
		if ($token == false) {
			$this->error($speaker->getError());
		}
		$this->success('获取成功', $token);
	}
	/**
	 * @name 获取微信access_token
	 * @method POST
	 * @return json ( expire_time & access_token )
	 */
	public function wechat()
	{
		$wxsdk = new Wxsdk;
		$token =  $wxsdk->getToken();
		if ($token == false) {
			$this->error($wxsdk->getError());
		}
		$this->success('获取成功', $token);
	}
}
